<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="任务名称" prop="taskName">
        <el-input v-model="queryParams.taskName" placeholder="请输入任务名称" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="绑定时间">
        <el-date-picker v-model="daterangeBindTime" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
          range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['exam:exe:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['exam:exe:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['exam:exe:remove']">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['exam:exe:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="exeList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="任务名称" align="center" prop="task.name" />
      <!-- <el-table-column label="用户名" align="center" prop="userId" /> -->
      <el-table-column label="任务完成进度" align="center" prop="taskStatus">
        <template #default="scope">
          <!-- 进度条 -->
          <el-progress :text-inside="true" :stroke-width="14"
            :percentage="parseFloat(((scope.row.completeNum / scope.row.totalNum) * 100).toFixed(1))" status="success">
          </el-progress>
        </template>
      </el-table-column>
      <el-table-column label="任务进度" align="center" prop="taskStatus">
        <template #default="scope">
          <!-- 显示数量 -->
          <span style="margin-left: 10px; font-size: 14px; color: #606266;">
            {{ scope.row.completeNum }}/{{ scope.row.totalNum }}
          </span>
        </template>
      </el-table-column>
      <el-table-column label="绑定时间" align="center" prop="bindTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.bindTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.row)"
            v-hasPermi="['exam:exe:export']">详情</el-button>
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
            v-hasPermi="['exam:exe:edit']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
            v-hasPermi="['exam:exe:remove']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

    <!-- 添加或修改任务执行列对话框 -->
    <el-dialog :title="title" :visible.sync="open" append-to-body :fullscreen="false" width="1400px">
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="任务" prop="taskId">
          <el-select v-model="form.taskId" filterable placeholder="请选择任务" style="width: 100%">
            <el-option v-for="item in taskList" :key="item.id" :label="item.name" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-row :gutter="20">
          <splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
            <!-- 部门数据 -->
            <pane size="30">
              <el-col class="dept-container">
                <div class="head-container">
                  <el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search"
                    style="margin-bottom: 10px" @input="filterDept" />
                </div>
                <div class="tree-container">
                  <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false"
                    :filter-node-method="filterDeptNode" ref="tree" node-key="id" default-expand-all highlight-current
                    @node-click="handleDeptNodeClick" class="dept-tree" />
                </div>
              </el-col>
            </pane>
            <!-- 用户数据 -->
            <pane size="70">
              <el-col>
                <div style="display: flex; align-items: center; margin-bottom: 10px;">
                  <!-- Position filter -->
                  <el-select v-model="positionFilter" clearable placeholder="按岗位筛选" size="small" style="width: 180px;"
                    @change="handlePositionFilterChange">
                    <el-option v-for="item in positionOptions" :key="item.value" :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                  <!-- Add quick filter button -->
                  <el-button type="primary" size="small" icon="el-icon-magic-stick" style="margin-left: 10px;"
                    @click="openQuickFilter">人员类型筛选</el-button>
                  <el-button type="primary" size="small" icon="el-icon-magic-stick" style="margin-left: 10px;"
                             @click="openMultiFilter">用户筛选</el-button>
                </div>
                <el-transfer v-model="form.userIds" :data="userList" v-loading="userLoading" :titles="['', '']"
                  filterable filter-placeholder="请输入用户名" class="user-transfer" :filter-method="userFilterMethod" />
              </el-col>
            </pane>
          </splitpanes>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- Quick filter dialog -->
    <el-dialog
      title="人员类型筛选"
      :visible.sync="quickFilterVisible"
      width="800px"
      append-to-body
    >
      <el-form label-width="80px" label-position="left" style="padding: 0 10px;">

        <!-- 表格 -->
        <el-table
          :data="shortTitleList"
          v-loading="peopleloading"
          element-loading-text="加载中..."
          highlight-current-row
          @current-change="handleShortTitleSelect"
          height="300"
          border
          style="margin-bottom: 15px; border-radius: 6px; overflow: hidden;"
        >
          <el-table-column
            label="试卷类型"
            prop="titleName"
            align="center"
            header-align="center"
          />
          <el-table-column
            label="人员类型"
            prop="peopleTypes"
            align="center"
            header-align="center"
          />
        </el-table>

        <!-- 筛选输入 -->
        <el-form-item label="人员类型">
          <el-input
            type="textarea"
            v-model="quickFilterText"
            :rows="8"
            placeholder="请输入部门和岗位列表，每行一个，格式: 部门-子部门-岗位"
            style="font-size: 13px;"
          />
        </el-form-item>

        <!-- 提示 -->
        <div style="color: #f56c6c; font-size: 12px; margin-left: 80px; line-height: 1.4;">
          💡 点击上方表格的行可自动填充人员类型
        </div>

      </el-form>

      <!-- 底部按钮 -->
      <div slot="footer" class="dialog-footer" style="text-align: right;">
        <el-button type="primary" @click="applyQuickFilter">确 定</el-button>
        <el-button @click="quickFilterVisible = false">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 多用户筛选 -->
    <el-dialog title="用户筛选" :visible.sync="multiUserVisible" width="600px" append-to-body>
      <el-form>
        <el-form-item label="筛选列表">
          <el-input type="textarea" v-model="userFilterText" :rows="8"
                    placeholder="请输入用户名用逗号隔开,格式：用户账号1,用户账号2"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="multiUserFilter">确 定</el-button>
        <el-button @click="multiUserVisible = false">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 任务详情对话框 -->
    <el-dialog :title="exeDetailTitle" :visible.sync="exeDetailOpen" append-to-body :fullscreen="false">
      <el-table v-loading="exeDetailLoading" :data="exeDetailList">
        <!-- <el-table-column type="selection" width="55" align="center" /> -->
        <el-table-column label="账号" align="center" prop="sysUser.userName" />
        <el-table-column label="用户名" align="center" prop="sysUser.nickName" />
        <el-table-column label="手机号" align="center" prop="sysUser.phonenumber" />
        <el-table-column label="邮箱" align="center" prop="sysUser.email" />
        <el-table-column label="班组" align="center" prop="sysUser.dept.deptName" />
        <el-table-column label="任务状态" align="center" prop="taskStatus">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.task_status" :value="scope.row.taskStatus" />
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
import { listExe, getExe, getExeDetail, delExe, addExe, updateExe } from "@/api/exam/exe";
import { listTask, getTask, delTask, addTask, updateTask } from "@/api/exam/task";
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { Splitpanes, Pane } from "splitpanes";
import "splitpanes/dist/splitpanes.css";
import {listPeopleTitleSummary } from "@/api/exam/peopleTitle";
export default {
  name: "Exe",
  dicts: ['task_status', 'education', 'technical_level'],
  components: { Treeselect, Splitpanes, Pane },
  data() {
    return {
      // 遮罩层
      loading: true,
      peopleloading:true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 任务执行列表格数据
      exeList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 绑定时间时间范围
      daterangeBindTime: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        taskName: null,
        bindTime: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        taskId: [
          { required: true, message: "任务ID，关联 t_task 表主键不能为空", trigger: "blur" }
        ],
        userId: [
          { required: true, message: "用户ID，关联 sys_user 表主键不能为空", trigger: "blur" }
        ],
        taskStatus: [
          { required: true, message: "任务状态，0，未完成，1，已完成不能为空", trigger: "change" }
        ],
        taskExamPaperAnswerId: [
          { required: true, message: "任务答卷ID，关联 t_task_exam_paper_answer 表主键不能为空", trigger: "blur" }
        ],
        bindTime: [
          { required: true, message: "绑定时间不能为空", trigger: "blur" }
        ]
      },
      taskList: [],
      deptName: null,
      // 所有部门树选项
      deptOptions: undefined,
      defaultProps: {
        children: "children",
        label: "label"
      },
      // 过滤掉已禁用部门树选项
      enabledDeptOptions: undefined,
      // 用户列表数据
      userList: [],
      userLoading: false,
      // 岗位筛选
      positionFilter: '',
      positionOptions: [],

      exeDetailOpen: false,
      exeDetailTitle: "任务详情",

      exeDetailList: [],
      exeDetailLoading: false,

      // Quick filter related
      quickFilterVisible: false,
      multiUserVisible:false,
      quickFilterText: '',
      userFilterText:'',
      filteredUserIds: [], // Store filtered user IDs
      shortTitleList: [], // 这里存接口返回的 shortTitles 数据
      selectedRow: null,   // 当前选中的行
    };
  },
  computed: {
    // 根据岗位筛选用户列表
    // 当前岗位筛选下未选择的用户
    filteredUnselectedUsers() {
      if (!this.positionFilter) {
        return this.userList.filter(user => !this.form.userIds.includes(user.key));
      }
      return this.userList.filter(
        user => !this.form.userIds.includes(user.key) && user.position === this.positionFilter
      );
    },
    // 已选择用户数量
    selectedUsersCount() {
      return this.form.userIds.length;
    }
  },
  created() {
    this.getList();
    this.geTTasktList();
    this.getDeptTree();
    this.getShortTitleList();
  },
  methods: {
    // 岗位筛选变化
    handlePositionFilterChange(val) {
      // 更新过滤条件，computed属性会自动重新计算
      this.positionFilter = val;
    },
    /** 查询任务执行列列表 */
    getList() {
      this.loading = true;
      this.queryParams.params = {};
      if (null != this.daterangeBindTime && '' != this.daterangeBindTime) {
        this.queryParams.params["beginBindTime"] = this.daterangeBindTime[0];
        this.queryParams.params["endBindTime"] = this.daterangeBindTime[1];
      }
      listExe(this.queryParams).then(response => {
        this.exeList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 获取任务列表数据
    geTTasktList() {
      const taskQueryParams = {
        pageNum: 1,
        pageSize: 999,
      }
      listTask(taskQueryParams).then(response => {
        // response.rows过滤掉过期数据和已经执行的任务
        this.taskList = response.rows.filter(item => !item.expire && item.taskStatus == 2);
      });
    },
    getUserList(deptId) {
      /** 查询用户列表 */
      let userQueryParams = {
        pageNum: 1,
        pageSize: 999,
        deptId: deptId,
      }
      this.userLoading = true;
      listUser(this.addDateRange(userQueryParams, this.dateRange)).then(response => {
        // 新部门用户
        const deptUsers = response.rows.map(item => {
          const positionName = item.posts && item.posts.length > 0 ?
            item.posts[0].postName : '无标识人员';
          return {
            key: item.userId,
            label: item.dept == null ?
              `${item.userName} (${item.nickName})` :
              `${item.userName} (${item.nickName}) - ${item.dept.deptName}`,
            position: positionName,  // 保存岗位信息
            originalData: item // Store original user data
          }
        });

        // 取已选用户
        const selectedUserIds = this.form.userIds || [];
        // 已选用户不在当前部门的
        const selectedUsers = (this.userList || []).filter(
          user => selectedUserIds.includes(user.key) && !deptUsers.some(u => u.key === user.key)
        );

        // 合并，保证已选用户不会丢失
        this.userList = deptUsers.concat(selectedUsers);
// console.info('userlist',this.userList)
        // 岗位选项只根据当前部门用户生成
        const positions = new Set();
        deptUsers.forEach(user => positions.add(user.position));
        this.positionOptions = Array.from(positions).map(pos => ({
          label: pos,
          value: pos
        }));

        this.userLoading = false;
      });
    },
    /** 查询部门下拉树结构 */
    getDeptTree() {
      deptTreeSelect().then(response => {
        this.deptOptions = response.data;
        this.enabledDeptOptions = this.filterDisabledDept(JSON.parse(JSON.stringify(response.data)));
      });
    },
    // 过滤禁用的部门
    filterDisabledDept(deptList) {
      return deptList.filter(dept => {
        if (dept.disabled) {
          return false;
        }
        if (dept.children && dept.children.length) {
          dept.children = this.filterDisabledDept(dept.children);
        }
        return true;
      });
    },
    // 获取 shortTitles 列表
    getShortTitleList() {
      listPeopleTitleSummary().then(res => {
        this.shortTitleList = res.rows
        this.peopleloading=false
        // console.log('shortTitleList', this.shortTitleList)
      })
    },
    // 部门树筛选
    filterDept() {
      this.$refs.tree.filter(this.deptName);
    },
    // 筛选节点
    filterDeptNode(value, data) {
      if (!value) return true;
      return data.label.toLowerCase().indexOf(value.toLowerCase()) !== -1;
    },
    // 节点单击事件
    handleDeptNodeClick(data) {
      this.handleUserQuery(data.id);
    },
    handleUserQuery(deptId) {
      this.getUserList(deptId);
    },
    // 穿梭框自定义筛选方法：岗位筛选只影响未选区，已选区始终显示
    userFilterMethod(query, item) {
      // If already selected or matches filter query
      if (this.form.userIds.includes(item.key) || item.label.includes(query)) {
        // If position filter is active, check position match
        if (this.positionFilter && !this.form.userIds.includes(item.key)) {
          return item.position === this.positionFilter;
        }
        return true;
      }
      return false;
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
      // 清空用户列表数据
      this.userList = [];
      // 清空岗位筛选
      this.positionFilter = '';
      this.positionOptions = [];
      // 重置部门树选中状态
      this.$refs.tree.setCurrentKey(null);
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        taskId: null,
        userId: null,
        taskStatus: null,
        taskExamPaperAnswerId: null,
        bindTime: null,
        userIds: [] // 确保清空选中的用户
      };
      this.resetForm("form");
      // 清空用户列表数据
      this.userList = [];
      // 清空部门搜索框
      this.deptName = '';
      // 清空岗位筛选
      this.positionFilter = '';
      this.positionOptions = [];
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeBindTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加任务执行列";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getExe(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改任务执行列";
        // 修改回显，会列出所有用户
        this.getUserList();
      });
    },
    /**详情按钮 */
    handleDetail(row) {
      this.reset();
      const taskId = row.taskId
      this.exeDetailOpen = true;
      this.exeDetailLoading = true;
      getExeDetail(taskId).then(response => {
        this.exeDetailList = response.data;
        this.exeDetailTitle = "任务执行详情";
        this.exeDetailLoading = false;
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.bindTime != null) {
            updateExe(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addExe(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
      //刷新任务列表
      this.geTTasktList();
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除任务执行列编号为"' + ids + '"的数据项？').then(function () {
        return delExe(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => { });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('exam/exe/export', {
        ...this.queryParams
      }, `exe_${new Date().getTime()}.xlsx`)
    },

    // Open quick filter dialog
    openQuickFilter() {
      // this.getShortTitleList();
      this.quickFilterText='';
      this.quickFilterVisible = true;
    },
    openMultiFilter(){
      this.userFilterText='';
      this.multiUserVisible=true;
    },

    // Apply quick filter
    applyQuickFilter() {
      // Split the input text by commas or new lines
      const filterItems = this.quickFilterText.split(/[\,\n]/).map(item => item.trim()).filter(item => item);

      if (!filterItems.length) {
        this.$message.warning('请输入筛选条件');
        return;
      }

      // Parse filter criteria
      const filterCriteria = filterItems.map(item => {
        const parts = item.split('-');
        if (parts.length > 1) {
          return {
            position: parts[parts.length - 1],
            deptParts: parts.slice(0, parts.length - 1)
          };
        } else {
          return {
            position: null,
            deptParts: [item]
          };
        }
      });

      // Filter users based on criteria
      const filteredUsers = this.userList.filter(user => {
        if (this.form.userIds.includes(user.key)) {
          return false;
        }
        const originalUser = user.originalData;
        if (!originalUser) {
          return false;
        }

        // 获取用户的部门路径，使用 deptPath 字段
        const userDeptPath = originalUser.deptPath || '';
        const userDeptParts = userDeptPath.split(',').map(part => part.trim()).filter(part => part);

        // 获取用户岗位
        let userPositions = [];
        if (originalUser.posts && originalUser.posts.length > 0) {
          userPositions = originalUser.posts.map(post => post.postName);
        } else {
          userPositions = ['无标识人员'];
        }

        // 检查是否匹配任一筛选条件
        return filterCriteria.some(criteria => {
          // 部门层级匹配：检查用户部门路径是否包含所有要求的部门层级
          const deptMatch = this.matchDepartmentHierarchy(userDeptParts, criteria.deptParts);

          // 岗位匹配
          let posMatch = false;
          if (!criteria.position) {
            posMatch = userPositions.includes('无标识人员');
          } else {
            posMatch = userPositions.includes(criteria.position);
          }

          return deptMatch && posMatch;
        });
      });

      if (filteredUsers.length === 0) {
        this.$message.warning('没有匹配的用户');
        return;
      }

      // Select these users by adding them to form.userIds
      const filteredUserIds = filteredUsers.map(user => user.key);
      this.form.userIds = [...new Set([...this.form.userIds, ...filteredUserIds])];

      this.$message.success(`已筛选并选择 ${filteredUserIds.length} 个用户`);
      this.quickFilterVisible = false;
    },
    multiUserFilter() {
      const filterItems = this.userFilterText.split(/[\,\n]/).map(item => item.trim()).filter(item => item);

      if (!filterItems.length) {
        this.$message.warning('请输入筛选条件');
        return;
      }

      const filteredUsers = this.userList.filter(user =>
        filterItems.includes(user.originalData.userName)
      );
// console.info('filteredUsers',filteredUsers)

      const filteredUserIds = filteredUsers.map(user => user.key);
      this.form.userIds = [...new Set([...this.form.userIds, ...filteredUserIds])];

      this.$message.success(`已筛选并选择 ${filteredUserIds.length} 个用户`);
      this.multiUserVisible=false;
    },
    // 选中行事件
    handleShortTitleSelect(row) {
      if (row && row.peopleTypes) {
        this.quickFilterText = row.peopleTypes
      } else {
        this.quickFilterText = ''
      }
    },
    // 匹配部门层级结构
    matchDepartmentHierarchy(userDeptParts, filterDeptParts) {
      if (!userDeptParts.length || !filterDeptParts.length) {
        return false;
      }

      // 检查筛选条件的每个部门层级是否都能在用户部门路径中按顺序找到
      let userIndex = 0;
      for (let filterIndex = 0; filterIndex < filterDeptParts.length; filterIndex++) {
        const filterDept = filterDeptParts[filterIndex];
        let found = false;

        // 从当前位置开始在用户部门路径中查找
        while (userIndex < userDeptParts.length) {
          if (userDeptParts[userIndex].includes(filterDept) || filterDept.includes(userDeptParts[userIndex])) {
            found = true;
            userIndex++; // 移动到下一个位置
            break;
          }
          userIndex++;
        }

        if (!found) {
          return false; // 如果任何一个层级都找不到，则不匹配
        }
      }

      return true; // 所有层级都找到了
    },
  }
};
</script>

<style scoped>
.dept-container {
  height: 450px;
  display: flex;
  flex-direction: column;
}

.tree-container {
  flex: 1;
  overflow: auto;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 4px;
  position: relative;
  height: calc(100% - 40px);
}

.dept-tree {
  padding: 10px 0;
}

/* 部门树节点样式 */
:deep(.el-tree-node__content) {
  height: 32px;
}

:deep(.el-tree-node.is-current > .el-tree-node__content) {
  background-color: #f5f7fa;
  color: #409EFF;
}

/* 穿梭框样式 */
.user-transfer {
  height: 450px;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

:deep(.el-transfer) {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
}

/* :deep(.el-transfer-panel) {
  width: 48% !important;
  height: 450px !important;
} */

::v-deep .el-transfer-panel {
  width: 48% !important;
  /* height: 450px !important; */
}

:deep(.el-transfer-panel__body) {
  height: calc(100% - 55px) !important;
}

:deep(.el-transfer-panel__list) {
  height: 100% !important;
}

:deep(.el-transfer-panel__list.is-filterable) {
  height: calc(100% - 32px) !important;
}

:deep(.el-transfer__buttons) {
  padding: 0 15px;
}

:deep(.el-transfer-panel .el-transfer-panel__header) {
  padding: 8px 15px;
  background: #f5f7fa;
}

:deep(.el-transfer-panel__item) {
  height: 32px;
  line-height: 32px;
  padding-left: 15px;
}

/* 对话框样式 */
:deep(.el-dialog) {
  margin-top: 8vh !important;
}

:deep(.el-dialog__body) {
  padding: 20px 20px;
}

/* 分割线样式 */
:deep(.splitpanes__splitter) {
  background-color: #f0f2f5;
  margin: 0 10px;
}
</style>
